<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>为班级选课</title>
    <th:block th:replace="headfoot/head::head_ztree"></th:block>
</head>

<body>
<div class="container-fluid kj-form-container">
    <form
            id="form" class="form-horizontal validate kj-form-container-content" role="form"
            method="post" action="/student/selection/saveClasses">

        <div class="from-group row has-feedback kj-form-title-button-bar">
            <div class="col-md-7">
                <button type="button" class="btn btn-default btn-sm action-ajax-form kj-btn-save">
                    <i class="iconfont icon-baocun"></i>&ensp;保存
                </button>
                <button type="button" class="btn btn-default btn-sm action-close-tab kj-btn-cancel">
                    <i class="iconfont icon-guanbi"></i>&ensp;取消
                </button>
            </div>

        </div>

        <div class="card kj-form-container-card">
            <div class="card-header kj-form-container-card-header">
                <h4>
                    <strong>班级选课信息</strong>
                </h4>
            </div>
            <div class="card-body kj-form-container-card-body">

                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">课程</label>
                    <div class="col-md-3 validateDiv">
                        <select	id="courseId" class="form-control input-sm kj-form-container-content-select"
                                   name="courseId"  data-rule-required="true">
                            <option value="">--选择课程--</option>
                            <option th:each="course:${courses}" th:value="${course.code}">[[${course.text}]]</option>

                        </select>
                    </div>

                    <label class="col-md-2 control-label kj-form-container-content-label">班级</label>
                    <div class="col-md-3 validateDiv">
                        <select	id="classesId" class="form-control input-sm kj-form-container-content-select select2"
                                   name="classesId"
                                   data-rule-required="true">
                            <option value="">--请选择--</option>
                            <option th:each="cls:${classes}" th:value="${cls.code}">[[${cls.text}]]</option>

                        </select>
                    </div>
                </div>

            </div>
        </div>
    </form>
</div>

<th:block th:replace="headfoot/foot::form_ztree_foot"></th:block>
<script type="text/javascript">
    function repeatCheck(value, ele) {
        $("#number").tooltip({
            html:true,
            title:"hahahah"

        }).data("error", true);
        //自定义验证
        var courseId = $("#courseId").val();
        var number = $("#number").val();
        var id = $("#id").val();
        if (courseId && number) {
            var url = "/student/selection/repeat"
            var check = false;
            $request.post(url, {
                data: {
                    id:id,
                    number:number,
                    courseId:courseId
                },
                async: false
            }, function(result) {
                check = result.data;
            });
            return check;
        }
        return true;
    }
</script>


</body>
</html>